package cn.six1943.deepchat.module.ai.dal.mysql.chatsession;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.six1943.deepchat.module.ai.dal.dataobject.chatsession.ChatMsgDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 会话消息 Mapper
 *
 * @author noday
 */
@Mapper
public interface ChatMsgMapper extends BaseMapperX<ChatMsgDO> {

    default PageResult<ChatMsgDO> selectPage(PageParam reqVO, Long sessionId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ChatMsgDO>()
            .eq(ChatMsgDO::getSessionId, sessionId)
            .orderByDesc(ChatMsgDO::getId));
    }

    default int deleteBySessionId(Long sessionId) {
        return delete(ChatMsgDO::getSessionId, sessionId);
    }

	default int deleteBySessionIds(List<Long> sessionIds) {
	    return deleteBatch(ChatMsgDO::getSessionId, sessionIds);
	}

}
